package com.xcw.bos.web.action;

import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.xcw.bos.domain.Function;
import com.xcw.bos.utils.BosContext;
import com.xcw.bos.web.action.base.BaseAction;
/**
 * 权限操作Action
 * @author xcw
 *
 */
@Controller
@Scope("prototype")
public class FunctionAction extends BaseAction<Function> {
    public String list(){
    	List<Function> list = functionService.findAll();
    	String[] excudes = new String[]{"childFunctions","roles","parentFunction"};
    	this.writeList2Json(excudes, list);
    	return NONE;
    }
    
    //保存权限
    public String save(){
    	functionService.save(model);
    	return "list";
    	
    }
    
    //根据登录用户查询系统菜单
    public String showMenu(){
    	List<Function> list = functionService.findMenu(BosContext.getLoginUser());
    	String[] excudes = new String[]{"childFunctions","roles","parentFunction"};
    	this.writeList2Json(excudes, list);
    	return NONE;
    }
}
